Skip to content

London | 26-ITP-May | Eyob Zeray | Sprint 2 | Book Library - #502

Open
eyob-tech wants to merge 6 commits into
CodeYourFuture:mainfrom
eyob-tech:feature/book-library
Open

London | 26-ITP-May | Eyob Zeray | Sprint 2 | Book Library#502
eyob-tech wants to merge 6 commits into
CodeYourFuture:mainfrom
eyob-tech:feature/book-library

Conversation

@eyob-tech

Copy link
Copy Markdown

Changelist

Fixed the following bugs in the Book Library debugging exercise:

  1. Website loads but doesn't show any books — missing closing parenthesis in the render() for-loop was causing a syntax error that broke the whole script
  2. Error in console when adding a book — submit() was pushing to an undefined library variable instead of myLibrary
  3. Title used as author name — Book() was being called with title.value passed twice instead of author.value for the author field
  4. Delete button broken — variable was declared as delButton but referenced as delBut, and the event listener used "clicks" instead of "click"
  5. Wrong read status saved — the Yes/No display logic was inverted
  6. Missing author validation — submit() only checked title and pages for empty values; added a check for author so a book can't be added without one, matching the spec

Tested manually in the browser: books display on load, adding a book with all fields works correctly, missing fields trigger the alert, read status toggles correctly, and delete removes the correct book.

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Fixed the bugs listed in the README:

  • Website not showing books: fixed a syntax error in render() (missing closing parenthesis)
  • Console error on adding a book: fixed submit() referencing an undefined variable instead of myLibrary
  • Title used as author: fixed Book() call to use the author field instead of duplicating the title
  • Delete button broken: fixed a variable name mismatch and an incorrect event listener name
  • Wrong read status saved: fixed inverted Yes/No logic
  • Also added validation so a book can't be submitted with a missing author, per the spec

…thor field, delete button, read status logic
…thor field, delete button, read status logic, missing author validation
@eyob-tech eyob-tech added 🏕 Priority Mandatory This work is expected 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Submit:PR Module-Data-Flows The name of the module. labels Jul 30, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check if any of this general feedback can help you further improve your code?
https://github.com/CodeYourFuture/Module-Data-Flows/blob/general-review-feedback/debugging/book-library/feedback.md

Doing so can help me speed up the review process. Thanks.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 3, 2026
@eyob-tech

Copy link
Copy Markdown
Author

Thanks for the pointer! Went through the general feedback doc and applied everything relevant to book-library:
script.js:
• Removed a duplicate render() call that was firing twice on page load
• Fixed colliding button IDs between read/delete buttons on different rows
• Fixed delete confirmation timing — deletion now completes before the alert shows, not after
• Simplified the read-status logic using a ternary operator
• Changed non-reassigned lets to const
• Renamed variables for clarity (e.g. title → titleInput, changeBut → changeButton)
• Switched .innerHTML to .textContent for inserting plain book data
index.html:
• Fixed the empty <title> tag
• Corrected invalid type="title"/type="author" attributes to type="text"
• Added min="1" on the pages input
• Fixed an HTML validation error — the charset and viewport meta tags were incorrectly combined into one; split them into two separate tags
• Added lang="en" to the tag
• Ran the file through validator.w3.org — no remaining errors (only harmless “Info” notices about optional trailing slashes on void elements)
Let me know if there’s anything else you’d like adjusted!

@eyob-tech eyob-tech added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 4, 2026
@eyob-tech
eyob-tech requested a review from cjyuan August 4, 2026 23:49

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good start.

I have some suggestions to further improve the code.

Comment thread debugging/book-library/index.html
Comment thread debugging/book-library/script.js Outdated
Comment thread debugging/book-library/script.js
Comment thread debugging/book-library/script.js Outdated
Comment thread debugging/book-library/script.js
Comment thread debugging/book-library/script.js Outdated
Comment thread debugging/book-library/script.js Outdated
Comment thread debugging/book-library/index.html Outdated
@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 5, 2026
…sanitize input, clear table via tbody, non-blocking delete message, enforce whole-number page validation, fix meta tag indentation
@eyob-tech eyob-tech added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 5, 2026
@eyob-tech
eyob-tech requested a review from cjyuan August 5, 2026 12:48
@cjyuan

cjyuan commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

All changes are great and all responses are spot on. Excellent job!

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. Module-Data-Flows The name of the module. 🏕 Priority Mandatory This work is expected 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants